Machi (Sega Saturn) script dumping tools (Python 3.x)

----setup--------------------------------------------------------------------

Some setup is needed before running to resolve ambiguity between different
files with the same name between both discs. This is handled by renaming
script (.SNB) files. For disc1, append "D1_" to all the files (D1_A1.SNB 
instead of A1.SNB). Do likewise for disc2 using "D2_".

----script tools-------------------------------------------------------------

The following tools are various dumpers for Machi script files. The 
motivation for doing this was to have the script files on-hand as an aid
to my inadequate Japanese ability (i.e. quick lookup w/ rikaichan, etc.).

machi_dump.py <file(s)>
Dumps script (.SNB) bytecode into .xml files. Both commands and text are
handled.

machi_txt.py <file(s)>
Converts .xml dumps to .txt files containing only the game text.

machi_html.py <file(s)>
Converts .xml dumps to .html files containing the game text as well as
hyperlinks for tips and zaps (nothing for choices yet). The html files
reference machi.css which should be one directory above.

machi_op.py
Opcode table (for script commands) that machi_dump.py uses. Only a few have
been properly named/figured out, others use generic names and arguments.

glyph.py
Contains text encoding tables for each of the script files, which must be
named in accordance to the -setup- step above.


----font tools---------------------------------------------------------------

Machi uses separate font files for each script, each using a custom encoding.
Dumping the scripts required that all 6381 individual character bitmaps be 
matched to their corresponding Unicode text character (which took many, many,
many hours). The following tools help create and manage this mapping.

The fonts are stored in the .GSF files on the discs. Using the tools requires
the same renaming operation ("D1_", "D2_") as described above with the
script (.SNB) files.

mfont.exe <infile> <outdir>
Dumps a font file (.GSF) into individual bmp images for each character.
Also prints out a transformation table that maps character index values to
crc32 values of their bitmap images.

transform.py
For each script file, maps character index values to crc32 values of the
bitmap images. Made by running mfont.exe on all the font files.

master.py
Master encoding table which maps crc32 values of the character bitmap image
to the characters themselves. glyph.py above is creating by combining this
table with transform.py

update_master.py
Updates the master encoding table (master.py) using entries from glyph.py.

update_glyph.py
Updates all the script file encoding tables in glyph.py from master.py.

The intent of the above two scripts was that the mapping was done by updating
a single encoding table in glyph.py by hand. Then update_master.py would be
run to generate the master encoding table, which is used by update_glyph.py
to fill in all the other encoding tables that share the same character bitmaps.

Any mistakes in the tables should be fixed by finding the affected character
in master.py, making the update there, and then running update_glyph.py to
apply the fix to all the individual encoding tables. To find the character in
master.py, first find the character index for the script encoding table in
glyph.py. Then use transform.py to get the crc32 value which tells you the
location in master.py. 

--kingshriek
